using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
using CSharpKit.Extensions;
using CSharpKit.Native.ECCODES;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace csk.ntv.grib
{
    [TestClass]
    public class UnitTest_GRIB_base
    {

        [TestMethod]
        public void base_00()
        {
            Assert.IsTrue(true);
            // --------------------------------------------------------------------------
            var v = eccodes.codes_get_api_version();
            // --------------------------------------------------------------------------
            Assert.IsTrue(true);
        }







        [TestMethod]
        public void base_01()
        {
            Assert.IsTrue(true);

            var fname = "d:/sfxData/ECMWF/eccodes_test_data/era5-levels-members.grib";
            Assert.IsTrue(File.Exists(fname));

            var fin = eccodes.codes_fopen(fname, FileOpenModel.Read);
            Assert.IsTrue(IntPtr.Zero != fin);
            // --------------------------------------------------------------------------

            // --------------------------------------------------------------------------
            // 关闭文件句柄
            var stats = eccodes.codes_fclose(fin);
            Assert.IsTrue(0 == stats);

            Assert.IsTrue(true);
        }


        // {{END}}
    }

}

